package javabase.desginpattern.structure.proxy.staticproxy;

import javabase.desginpattern.structure.proxy.HelloImpl;
import javabase.desginpattern.structure.proxy.IHello;

/**
 * @author fance
 * @date 18-4-27 下午4:35
 */
public class HelloProxy implements IHello {
    private IHello hello;

    public HelloProxy() {
        hello = new HelloImpl();
    }

    @Override
    public void say(String name) {
        before();
        hello.say(name);
        after();
    }

    private void before() {
        System.out.println("before");
    }
    private void after() {
        System.out.println("after");
    }

    public static void main(String[] args) {
        IHello helloProxy = new HelloProxy();
        helloProxy.say("fance");
    }
}
